<template>
    <div class="modal fade bs-example-modal-lg" id="verifyhealthnews" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="myModalLabel">
                {{modaltitle}}</h4>
                    </div>
                    <div class="modal-body">
                         <div class="changeinfo cbafter">
                            <div class="changeinfo_head cbafter">
                                <span>申请人：{{username}}</span>
                                <span>申请时间：{{applytime}}</span>
                            </div>
                             <div class="cb changeinfo_con">
                                <div class="fl">
                                    <img :src="lookitem.infoTitlePicture" width="120" height="80" class="titimg">
                                </div>
                                <div class="fl lectureTitle">
                                    <h3>{{lookitem.infoTitle}}
                                                <div class="btn-group" role="group">
                                               <button type="button" class="btn btn-default nogo">{{lookitem.infoTypeText}}</button>
                                                </div>
                                            </h3>
                                    <p class="talktime">发布时间：<span>{{lookitem.infoVerifyTime}}</span></p>
                                    <p class="talkdoc">发布医生：<span>{{lookitem.infoApplyUserName}} {{lookitem.levelText}}</span></p>
                                </div>
                                <div class="cb lookcontent">{{{lookitem.infoContent}}}</div>
                            </div>
                        </div>
                          <form class="form-horizontal" role="form" id="changedocform"  v-on:submit.prevent="verifyhealthnewssave">
                            <div class="form-group">
                                <label class="col-md-3 control-label" style="padding-top:15px">审核意见：</label>
                                <div class="col-md-8">
                                    <div class="radio">
                                        <label class="checkbox-inline">
                                            <input type="radio" name="verifyvalue" value="1" required v-model="verifyhealthnewsdata.verifyvalue">通过
                                        </label>
                                        <label class="checkbox-inline">
                                            <input type="radio" name="verifyvalue" value="2" required v-model="verifyhealthnewsdata.verifyvalue">不通过
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group" v-show="verifyhealthnewsdata.verifyvalue=='2'">
                                <label class="col-md-3 control-label">不通过理由 :</label>
                                <div class="col-md-8" >
                                    <textarea class="form-control" rows="3" placeholder="请输入审核不通过的理由" v-model="verifyhealthnewsdata.verifySuggestion" :required="verifyhealthnewsdata.verifyvalue=='2'"></textarea>
                                </div>
                            </div>
                            <div class="form-group save">
                                <button type="submit" class="default ok center">确认</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
</template>
<script>
import Public from 'assets/public.js'
module.exports = {
    data() {
            return {
               lookitem: {
                    "infoId": "",
                    "infoTitle": "",
                    "infoTitlePicture": 0,
                    "infoContent": "",
                    "infoType": "",
                    "infoApplyUser": "",
                    "infoApplyUserName": "",
                    "level": "",
                    "infoApplyTime": "",
                    "infoVerifyUser": "",
                    "infoVerifyUserName": "",
                    "infoVerifyTime": "",
                    "verifyState": "",
                    "status": "",
                    "infoTypeText": "",
                    "verifyStateText": "",
                    "levelText": "",
                    verifySuggestion: "",
                },
                 verifyhealthnewsdata:{//审核
                  verifySuggestion:"",
                  verifyvalue:""
                }
            }
        },
        props: {
            "username": {
                type: String,
                default: ""
            },
             "applytime": {
                type: String,
                default: ""
            },
             "imgurl": {
                type: String,
                default: ""
            },
            
             "modaltitle": {
                type: String,
                default: ""
            },

        },
        ready() {
           
        },
        methods: {
              // 审核弹框
                verifyhealthnews(item){
                   $("#verifyhealthnews").modal("show");
                    this.modaltitle = "健康资讯审核";
                    this.verifyhealthnewsdata.verifySuggestion="";
                    this.username = item.infoApplyUserName;
                    this.applytime = item.infoApplyTime;
                     // item.infoContent = item.infoContent.replace(/(style="[^"]+")/g,"style='width:100%;height:auto'");
                    this.lookitem = item;
                },
                // 审核保存
                verifyhealthnewssave(){
                  var that=this;
                  if(this.verifyhealthnewsdata.verifyvalue==1){
                    this.verifyhealthnewsdata.verifySuggestion="";
                  }
                   this.verifyhealthnewsdata.verifySuggestion = this.verifyhealthnewsdata.verifySuggestion.replace(/\n/g, "");
                  $.when(Public.commonajax("coms.healthMessageService", "verifyHealthMessage", "['" + this.lookitem.infoId +"','"+this.verifyhealthnewsdata.verifySuggestion+"']"))
                        .done(function(res) {
                            if (res.code == 200) {
                                Public.ajaxPrompt("提交成功");
                                $("#verifyhealthnews").modal("hide");
                                that.$dispatch('verifyhealthnewssave');
                                
                            }
                        })
                }
        },
}
</script>
<style scoped>
#verifyhealthnews .lectureTitle {
    width: 650px;margin-left: 10px; padding-bottom: 10px; 
   
}
#verifyhealthnews .changeinfo_con img.titimg{width:100px; height: 72px;margin-top: 5px}
#verifyhealthnews .changeinfo h3{font-size: 14px;line-height: 24px;}
#verifyhealthnews .changeinfo p{font-size: 12px;line-height: 24px;}
#verifyhealthnews .lookcontent{ padding-top: 10px; border-top:2px dotted #ccc;}
#verifyhealthnews .changeinfo_con{height:300px;overflow-y: auto;} 
#verifyhealthnews .lookcontent img{ width: 398px;height: auto }
.btn-default {
    padding: 3px 12px;
    color: #1dc499;
    border: 1px solid #1dc499;
}

.btn-default:hover,
.btn-default:focus,
.btn-default.focus,
.btn-default:active,
.btn-default.active {
    color: #fff;
    background-color: #1dc499;
    border-color: #ccc;
    cursor: default;
}

.go.btn-default:hover,
.go.btn-default:focus,
.go.btn-default.focus,
.go.btn-default:active,
.go.btn-default.active {
    cursor: pointer;
    color: #1dc499;
    border: 1px solid #1dc499;
}

.nogo.btn-default:hover,
.nogo.btn-default:focus,
.nogo.btn-default.focus,
.nogo.btn-default:active,
.nogo.btn-default.active {
    background-color: #fff;
    color: #1dc499;
    border: 1px solid #1dc499;
}
.changeinfo_con{width: 830px}
</style>
